﻿using System;
using System.Xml.Linq;
using HigLabo.Net.Extensions;
using System.Collections.Generic;
using Newtonsoft.Json.Linq;



namespace HigLabo.Net.Twitter
{
    /// <summary>
    /// 
    /// </summary>
    public class Place : ResponseObject
    {
        /// <summary>
        /// 
        /// </summary>
        public Attributes Attributes { set; get; }
        /// <summary>
        /// 
        /// </summary>
        public BoundingBox BoundingBox { set; get; }
        /// <summary>
        /// 
        /// </summary>
        public String Country { set; get; }
        /// <summary>
        /// 
        /// </summary>
        public String CountryCode { set; get; }
        /// <summary>
        /// 
        /// </summary>
        public String FullName { set; get; }
        /// <summary>
        /// 
        /// </summary>
        public String ID { set; get; }
        /// <summary>
        /// 
        /// </summary>
        public String Name { set; get; }
        /// <summary>
        /// 
        /// </summary>
        public String PlaceType { set; get; }
        /// <summary>
        /// 
        /// </summary>
        public String Url { set; get; }
        /// <summary>
        /// 
        /// </summary>
        public PlaceCollection ContainedWithin { set; get; }
        /// <summary>
        /// 
        /// </summary>
        public BoundingBox Geometry { set; get; }
        /// <summary>
        /// 
        /// </summary>
        public String Polylines { set; get; }



        /// <summary>
        /// 
        /// </summary>
        /// <param name="jsonText"></param>
        public Place(String jsonText)
        {
            this.SetProperty(jsonText);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="jsonText"></param>
        public override void SetProperty(string jsonText)
        {
            var d = this.SetData(jsonText);

            this.Attributes = new Attributes(d.ToString("attributes"));
            this.BoundingBox = new BoundingBox(d.ToString("bounding_box"));
            this.Country = d.ToString("country");
            this.CountryCode = d.ToString("country_code");
            this.FullName = d.ToString("full_name");
            this.ID = d.ToString("id");
            this.Name = d.ToString("name");
            this.PlaceType = d.ToString("place_type"); 
            this.Url = d.ToString("url");
            this.ContainedWithin = new PlaceCollection(d.ToString("contained_within"));
            this.Geometry = new BoundingBox(d.ToString("geometry"));
            this.Polylines = d.ToString("polylines");
        }
    }
}
